My example function doesn’t change the type, though.
It could, however, but even then I would expect it to work, and the only thing that should happen is a run-time error in case the user tries to use the changed variable incorrectly with regards to types...
That would be my expected behaviour for ref.